import { BuilderOptions, Extensions } from "./Defines";

class _Environment {

    private static _instance: _Environment = null!;
    static get instance() {
        return this._instance || (this._instance = new _Environment);
    }
    /**@description 对外公布示例地址*/
    readonly publicBundlesUrl = "https://gitee.com/top-discover/QuickFrameworkBundles.git";
    
    /**@description cocos creator 安装目录 需要按自己的安装路径修改 */
    readonly creatorPath: string = "C:/ProgramData/cocos/editors/Creator/2.4.11";

    /**@description cocos creator 版本 */
    readonly creatorVersion: string = "2.4.11";

    /**@description 支持版本 */
    readonly supportVersions: string[] = ["2.4.11"];

    /**@description 扩展插件目录名 */
    readonly extensionsName: string = "packages";

    readonly build: BuilderOptions = {
        platform: "Win32",
        dest: "../snack/build/jsb-link",
        md5Cache: false,
    }

    /**@description 是否在tools目录下执行命令 */
    isCommand: boolean = false;

    /**@description 项目插件 */
    readonly extensions: string[] = [
        Extensions.CheckResources,
        Extensions.FixEngine,
        Extensions.Hotupdate,
        Extensions.PngCompress,
        Extensions.TestServer,
    ]

    /**@description 是否需要 core
     * @param extensionsName 扩展插件名
     */
    isLinkCore(extensionsName: string): boolean {
        return true;
    }

    /**@description 是否需要 impl
     * @param extensionsName 扩展插件名
     */
    isLinkImpl(extensionsName: string): boolean {
        return extensionsName !== Extensions.CheckResources;
    }

    /**@description 是否需要 node_modules
     * @param extensionsName 扩展插件名
     */
    isLinkNodeModules(extensionsName: string): boolean {
        return true;
    }

    /**@description 是否是3.x版本 Creator */
    get isVersion3X(): boolean {
        return false;
    }

    /**@description 是否进行代码混淆 */
    readonly isGulpCompex: boolean = false;

    isSupportUpdate(platform: string): boolean {
        if (platform == "android" || platform == "windows" || platform == "ios" || platform == "mac" || platform == "win32") {
            return true;
        }
        return false;
    }

    
    /**@description 项目 Bunldes 目录名 */
    get bundleName(){
        return "bundles";
    }

    /**@description 项目基础包 resources 目录名 */
    get resources(){
        return "resources";
    }
}

export const Environment = new _Environment();